VCS       =/edatools/synopsys/VCS/D-2009.12/bin/vcs
SRC       =../rtl/sinc2.v ../tb/tb.v 
TGT       =simv
TEST     ?=
COM_ARGS ?= 
VERDI     =verdi
VERDI_PATH=/edatools/Verdi2009
VERDI_TAB =$(VERDI_PATH)/share/PLI/vcs/LINUX/verdi.tab
VERDI_PLI =$(VERDI_PATH)/share/PLI/vcs/LINUX/pli.a
FLIST     = run.f
WAVE      ?=FSDB_DUMP

VLOG_DEF ?=
FLAGS = -P $(VERDI_TAB) $(VERDI_PLI) -timescale=1ns/1ps -debug_pp +define+${VLOG_DEF}
SEED ?= 123
SIM_ARGS ?= 


TEST   = tb

SIM_ARGS += +DUMP_FILE=$(TEST)_$(SEED).fsdb
COM_ARGS += -Mupdate -cm tgl -cm_dir $(TEST)_$(SEED)_coverage

all:simv run 

simv: $(SRC)
        $(VCS) -f $(FLIST) -sverilog $(FLAGS) $(COM_ARGS) +define+$(WAVE) -l build.log 

run:
	echo $(TEST)
	./simv $(SIM_ARGS) +vcs+lic+wait $(COM_ARGS) -l $(TEST)_$(SEED)_vcs.log

seewave:
	$(VERDI) -f $(FLIST) -top tb -ssf ./$(TEST)_$(SEED).fsdb $(COM_ARGS) &

seecov :
	rm urgReport -rf ; rm p004_coverage.cm -rf
	urg -dir *_coverage -dbname p004_coverage
	urg -dir p004_coverage.cm
	firefox urgReport/dashboard.html &

clean:
        rm simv; rm csrc -rf ; rm *.daidir -rf; rm out -rf ; rm verdiLog -rf; rm vcs.log ; rm novas* ; rm ucli.key 

